package tad;

import java.io.Serializable;

import constants.Occupation;



public class Cell implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6883310687113416535L;
	private int x;
	private int y;
	private int busy;
	
	public static int tamCelda = 8;
	
	/**PARA A* => f=g+h;
	 * PARA ANCHURA =>f=h
	 * PARA PROFUNDIDAD =>f=h
	 */
	private double f;
	private double g = Integer.MAX_VALUE;
	private int h;
	private boolean objetivo = false;
	
	private Cell padre;
	
	public Cell(int x, int y, int busy) {
		super();
		this.x = x;
		this.y = y;
		this.busy = busy;
	}
	public Cell(int x, int y, boolean busy) {
		super();
		this.x = x;
		this.y = y;
		if (busy)
			this.busy = Occupation.PERMANENT_OBSTACLE;
		else
			this.busy = Occupation.FREE;
	}
	
	public boolean isObjetivo(){
		return objetivo;
	}
	
	public void setObjetivo(boolean isObjetivo){
		objetivo = true;
	}

	public Cell(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public double getF() {
		return f;
	}



	public void setF(double f) {
		this.f = f;
	}



	public double getG() {
		return g;
	}



	public void setG(double g) {
		this.g = g;
	}

	public double getW() {
		return g+f;
	}

	public int getH() {
		return h;
	}



	public void setH(int h) {
		this.h = h;
	}



	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getBusy() {
		return busy;
	}

	public void setBusy(int busy) {
		this.busy = busy;
	}

	public Cell getPadre() {
		return padre;
	}

	public void setPadre(Cell padre) {
		this.padre = padre;
	}
	
	@Override
	public String toString()
	{
		
		return x + "." + y + "(" + h + "+" + (int)g + ")";
	}
	
}
